package com.print;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import org.krysalis.barcode4j.impl.datamatrix.DataMatrixBean;
import org.krysalis.barcode4j.output.bitmap.BitmapCanvasProvider;

import com.swetake.util.Qrcode;

public class Main1 {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		DataMatrixBean dmb = new DataMatrixBean();
		BitmapCanvasProvider canvas = new BitmapCanvasProvider(300,
				BufferedImage.TYPE_BYTE_BINARY, true, 0);
		dmb.setModuleWidth(1.9);
		dmb.generateBarcode(canvas, "Hello, World");
		canvas.finish();
		BufferedImage bi = canvas.getBufferedImage();
		bi.flush();
		File imgFile = new File("E:\\test1.png");
        try {
            ImageIO.write(bi, "png", imgFile);
        } catch (IOException e) {
            e.printStackTrace();
        }
	}

}
